#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: david
# @Date:   2017-03-02 17:51:33
# @Last Modified by:   anchen
# @Last Modified time: 2017-03-08 11:17:44

import tkinter as tk

class Application():
    def __init__(self, root):
        self.root=root
        self.createFrameTop()
        self.createFrameBottom()

    def createFrameTop(self):
        self.frm_top_label=tk.Label(self.root, text="xxx平台", fg="blue", bg="yellow", font=('Tempus Sans ITC', 20))
        self.frm_top_label.grid(row=0, column=0, padx=15, pady=2)

    def createFrameBottom(self):
        self.frm_bottom=tk.LabelFrame(self.root)
        self.frm_bottom.grid(row=1, column=0, padx=15, pady=2)

        self.frm_bottom_label_0=tk.Label(self.frm_bottom, text="用户名：", font=('Tempus Sans ITC', 15))
        self.frm_bottom_label_0.grid(row=0, column=0, padx=15, pady=2, sticky="e") # 控件右对齐

        self.frm_bottom_label_1=tk.Label(self.frm_bottom, text="密码：", font=('Tempus Sans ITC', 15))
        self.frm_bottom_label_1.grid(row=1, column=0, padx=15, pady=2, sticky="e")

        self.frm_bottom_entry_var_0=tk.StringVar()
        self.frm_bottom_entry_0=tk.Entry(self.frm_bottom, textvariable=self.frm_bottom_entry_var_0)
        self.frm_bottom_entry_0.grid(row=0, column=1, padx=15, pady=2)

        self.frm_bottom_entry_var_1=tk.StringVar()
        self.frm_bottom_entry_1=tk.Entry(self.frm_bottom, textvariable=self.frm_bottom_entry_var_1, show="*") # 设置密码输入框，属性show
        self.frm_bottom_entry_1.grid(row=1, column=1, padx=15, pady=2)

        self.frm_bottom_cbtn_init_0=tk.IntVar()
        self.frm_bottom_cbtn_0=tk.Checkbutton(self.frm_bottom, variable=self.frm_bottom_cbtn_init_0, text="记住密码", font=('Tempus Sans ITC', 10))
        self.frm_bottom_cbtn_0.grid(row=2, column=1, padx=15, pady=2, sticky="w") # 控件左对齐

        self.frm_bottom_btn_0=tk.Button(self.frm_bottom, text="登    录", relief=tk.RIDGE, bd=4, width=10, font=('Tempus Sans ITC', 12), command=self.show_info)
        self.frm_bottom_btn_0.grid(row=3, column=1, padx=15, pady=2)

    def show_info(self):
        print(self.frm_bottom_entry_var_0.get())
        print(self.frm_bottom_entry_var_1.get())
        print(self.frm_bottom_cbtn_init_0.get())

if __name__ == '__main__':
    root=tk.Tk()
    root.title("LOGIN")
    Application(root)
    root.mainloop()